import {Http} from '@angular/http';
import {NgLayer, NgLayerRef} from 'ng2-layer';
import {Component,ViewContainerRef, Injectable}  from '@angular/core';
/**
 * 左侧菜单部分
 */
@Component({
	selector: '.category',
	templateUrl: 'template/router/setting.html'
})
export class SettingComp {
	tab = "base";
	
	constructor(private http:Http, private layer:NgLayer){
		this.http.get({
			search:{
				m:"Admin",
				c:"ApiWallet",
				a:"get_user_wallet"
			}
		}).then((data)=>{
			this.isbind = data.data.is;
			if(this.isbind==0){
				this.router.navigateByUrl('/bind_wx');
			}
		});
	}
	
	swichTab(tab){
		this.tab = tab;
	}
	
	/**
	 * 
	 */
	savePwd(){
		this.http.post({
			search:{
				m:"Admin",
				c:"ApiAdmin",
				a:"updateAdminPassword"
			},
			body:{
				oldPassword:this.oldPassword,
				newPassword:this.newPassword
			}
		}).then((data)=>{
			layer.tip({
				message:"密码修改成功",
				align:"top"
			});
		});
	}
}